<?php

/*
 * Libreria que permite cargar todos los mensajes de error de validacion
 * al inicio de la aplicacion (tipo bootstrap)
 *
 * mensajes de error en application/config/config.php
 * $config['validation_messages']
 */

/**
 * Description of ValidationMessages
 *
 * @author Administrador
 */
if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Validationmessages {

    public $obj;
    public $messagesArray = array();

    function Validationmessages($messages = 'validation_messages') {
        $this->obj = & get_instance();
        $this->obj->load->library('form_validation');
        $this->messagesArray = $this->obj->config->item($messages);
        $this->_init();
    }

    private function _init() {
        foreach ($this->messagesArray as $msj) {
            $this->obj->form_validation->set_message($msj['type'], $msj['message']);
        }
    }

}
?>